﻿using System;
using System.IO;
using System.Text;


class ConcatTextFiles
{
    static void Main()
    {
        using (StreamWriter concatFileWriter = new StreamWriter("afterconcat.txt"))
        {
            using (StreamReader firstFileReader = new StreamReader("firstfile.txt"))
            {
                string readedLine = firstFileReader.ReadLine();
                while (readedLine != null)
                {
                    concatFileWriter.WriteLine(readedLine);
                    readedLine = firstFileReader.ReadLine();
                }
            }
        }
        using (StreamWriter concatFileWriter = new StreamWriter("afterconcat.txt",true))
        {
            using (StreamReader secondFileReader = new StreamReader("secondfile.txt"))
            {
                string readedLine = secondFileReader.ReadLine();
                while (readedLine != null)
                {
                    concatFileWriter.WriteLine(readedLine);
                    readedLine = secondFileReader.ReadLine();
                }
            }
        }
        using (StreamReader concatFileReader = new StreamReader("afterconcat.txt"))
        {
            string readedLine = concatFileReader.ReadLine();
            while (readedLine != null)
            {
                Console.WriteLine(readedLine);
                readedLine = concatFileReader.ReadLine();
            }
        }
    }
        
}

